/*tav* $$_FILE_HEADER_ZONE *tav*/
/*tav* howToImport : import $$_FILE_NAME from "$$_RELATIVE_PATH" *tav*/
/*tav* headerTypeName : HeaderParams *tav*/
/*tav* queryTypeName : QueryParams *tav*/
/*tav* bodyTypeName : BodyParams *tav*/
/*tav* respTypeName : Response *tav*/
/*tav* headerValName : header *tav*/
/*tav* queryValName : params *tav*/
/*tav* bodyValName : body *tav*/

import { CancelHolder } from '@/network';
import { apiHttp } from '@/network/ApiHttp';
import { checkReply } from './checkReply';

export namespace $$_FILE_NAME {

  /*tav* $$_TYPE_DECLARATIONS_ZONE *tav*/
  
  /**
   * call函数的参数
   */
  export type CallArgs = Parameters<typeof call>

  export async function call(
    $$_I_HEADER: $$_I_HEADER_TYPE,
    $$_I_PARAMS: $$_I_PARAMS_TYPE,
    $$_I_BODY: $$_I_BODY_TYPE,
    canceller?: CancelHolder
  ): Promise<$$_RESPONSE_TYPE> {

    const url = __API_URL_BASE__ + "$$_URL";

    const reply = await apiHttp[$$_HTTP_METHOD_STR]<any, any>({
      url,
      params: $$_I_PARAMS_OR_UNDEFINED,
      headers: $$_I_HEADER_OR_UNDEFINED,
      data: $$_I_BODY_OR_UNDEFINED,
      ...canceller?.signals()
    })
    
    return checkReply<any>(reply)
  }
}
export default $$_FILE_NAME;